{{include template('public/header','admin')}}
<link href="{{STATIC_URL}}/plugins/calendar/calendar.css" rel="stylesheet" type="text/css"/>
<script src="{{STATIC_URL}}/plugins/calendar/calendar.js" type="text/javascript"></script>
<script type="text/javascript">
function batchremove(){
var addressVal = $("input[name='optype']:checked").val();
var msg = "请选择";
if (addressVal == "del"){
msg = '确认要删除吗？';
} else if (addressVal == "lock"){
msg = '确认要锁定用户吗？';
} else if (addressVal == "reset"){
msg = '您确认要将登录密码重置为{{$default_password}}<br>(系统设置里可以修改重置默认密码)';
} else{
msg = "请选择";
}
layer.confirm(msg, function (index) {if (msg != "请选择"){document.getElementById('cpform').submit(); }});
}
</script>
<body>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <div class="search">
                    <div class="well">
                        <form class="form-inline" method="get">
                            <div class="form-group">
                                <label>{{L('member_dateline')}}</label>
                                <input type="text" name="startdate" value="{{$search['startdate']}}" class="calendar-icon form-control" value="" style="width:110px;" onclick="showcalendar(event, this)"   />
                                <input type="text" name="enddate" value="{{$search['enddate']}}" class="calendar-icon form-control" value="" style="width:110px;" onclick="showcalendar(event, this, false)"  />
                            </div>
                            <div class="form-group">
                                <label for="status">{{L('member_status')}}</label>
                                <select id="search[status]" name="search[status]" class="form-control">
                                    <option value="">{{L('member_status')}}</option>
                                    <option value="1" {{if $search['status'] eq '1' }}selected {{/if}} >正常</option>
                                    <option value="2" {{if $search['status'] eq '2' }}selected {{/if}} >锁定</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="groupid">{{L('group')}}</label>
                                {{showselectusergroup($search['groupid'])}}
                            </div>
                            <div class="form-group">
                                <label for="type">{{L('keyword')}}</label>
                                <select name="type" class="form-control">
                                    <option value="username" {{if $search['type'] eq 'username'}}selected{{/if}}>{{L('member_username')}}</option>
                                    <option value="uid" {{if $search['type'] eq 'uid'}}selected{{/if}}>{{L('member_uid')}}</option>
                                    <option value="email" {{if $search['type'] eq 'email'}}selected{{/if}}>{{L('member_email')}}</option>
                                </select>
                                <input type="text" class="form-control" id="keyword" name="keyword" value="{{$search.keyword}}" maxlength="15" tabindex="2" />
                            </div>
                            <button type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i>{{L('search')}}</button>
                            <a onclick="layer_open('添加用户', '{{url('member/member/add')}}', '800', '450')" href="javascript:;" class="btn btn-success" ><i class="fa fa-fw fa-plus"></i>{{L('add')}}</a>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <form id='cpform' name='cpform' method="post" action="/member/member/batchremove" class="form-inline" role="form">
                    <table id='MemberList' class="table table-condensed table-hover table-striped tablesorter table-fixed table-selectable">
                        <thead>
                            <tr>
                                <th style="width: 15px;"><input type="checkbox" name="chk" class="checkbox" onclick="checkAll('prefix', this.form, 'ids', 'chk')" /></th>
                                <th>{{L('member_uid')}}</th>
                                <th>{{L('member_username')}}</th>
                                <th>{{L('member_email')}}</th>
                                <th>{{L('member_score')}}</th>
                                <th>{{L('member_experience')}}</th>
                                <th>{{L('member_regip')}}</th>
                                <th>{{L('member_lastlogintime')}}</th>
                                <th>{{L('member_loginnum')}}</th>
                                <th>{{L('member_groupid')}}</th>
                                <th>{{L('member_status')}}</th>
                                <th>{{L('edit')}}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{foreach $items as $item}}
                            <tr>
                                <td><input type="checkbox" class="checkbox" name="ids[]" value="{{$item.uid}}" /></td>
                                <td >{{$item.uid}}</td>
                                <td >{{$item.username}}</td>
                                <td >{{$item.email}}</td>
                                <td >{{$item.amount}}</td>
                                <td >{{$item.experience}}</td>
                                <td >{{$item.regip}}</td>
                                <td>{{$item.lastlogintime}}</td>
                                <td>{{$item.loginnum}}</td>
                                <td>{{get_groupname($item.groupid)}}</td>
                                <td>{{update_status('member','member','uid',$item.uid,'status',$item.status)}}</td>
                                <td style="width: 15%">
                                    <a href="/member/member/update/?uid={{$item.uid}}" class="btn btn-warning btn-xs">{{L('edit')}}</a>
                                </td>
                            </tr>
                            {{/foreach}}
                        </tbody>
                        <tr>
                            <td colspan="15">
                                <div class="form-inline " style="text-align: left;">
                                    <div  style="float: left;">
                                        <input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll('prefix', this.form, 'ids')" />{{L('chkall')}}
                                        <input type="radio" class="radio" id="optype_outer" name="optype" value="del" />{{L('delete')}}
                                        <input type="radio" class="radio" name="optype" value="lock" />{{L('lock_user')}}
                                        <input type="radio" class="radio" name="optype" value="reset" />{{L('reset_password')}}
                                        <input type="button" class="btn" name="sendsubmit" value="{{L('submit')}}" onclick="batchremove()"/>
                                    </div>
                                    <div  style="float:right;">
                                        {{include template('public/page','admin')}}
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
